<?php
/**
 * 创建人 : Forpastime
 * 创建时间: 2024/10/20 17:25
 * 个人主页 : http://forpastime.com
 */

namespace App\Middleware;


use Hyperf\HttpServer\Contract\RequestInterface;
use Hyperf\HttpServer\Contract\ResponseInterface as HttpResponse;
use Psr\Container\ContainerInterface;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface;
use Psr\Http\Server\MiddlewareInterface;
use Psr\Http\Server\RequestHandlerInterface;

class ParamsMiddleware implements MiddlewareInterface
{
    /**
     * @var ContainerInterface
     */
    protected $container;

    /**
     * @var HttpResponse
     */
    protected $response;

    /**
     * @var HttpRequest
     */
    protected $request;

    /**
     * TokenMiddleware constructor.
     * @param HttpResponse $response 注意这里的respons 是 ResponseInterface 是hyperf
     * @param RequestInterface $request 注意这里的request 是 RequestInterface  是hyperf
     */
    public function __construct(ContainerInterface $container, HttpResponse $response, RequestInterface $request)
    {
        $this->container = $container;
        $this->request = $request;
        $this->response = $response;
    }

    /**
     * @param ServerRequestInterface $request 注意这个 request 是psr的request 并非 hyperf的
     * @param RequestHandlerInterface $handler
     * @return ResponseInterface
     * Created by Forpastime at 2024/10/20
     */
    public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
    {
        $params = $this->request->all();
        //对参数进行AES解密
    }
}